<script setup>
import utils from "../FieldUtil.js"
import { defineProps, computed } from "vue";
const { meta, vm } = defineProps(["meta", "vm"]);
const model = vm.getModel(meta.model);

const editMode = computed(() => {
  return utils.editMode(meta, model);
});

const value = computed({
  get() {
    return utils.get(meta, model);
  },
  set(newValue) {
    utils.set(meta, model, newValue);
  }
});

</script>

<template>
  <el-input v-if="editMode" v-model="value" type="textarea" rows="4" />
  <el-text v-else class="m-2">{{ value }}</el-text>
</template>